home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1987 / 04 / pj4-l4.asm < prev   
Assembly Source File  |  1987-10-12  |  896b  |  32 lines

  1. ; Program to accompany Michael Abrash's code.  Code submitted to make
  2. ; a point illustrating a letter to Michael
  3. ; Listing 4.
  4. ; Copyright by John Navas.
  5. cseg    SEGMENT
  6.     ASSUME    cs:cseg
  7. mproc    MACRO                ; for local names
  8.     LOCAL    locs,field1,field2,loc1,loc
  9. locs    STRUC                ; local storage on stack
  10. field1    DW    ?
  11. field2    DW    ?
  12. locs    ENDS
  13. loc1    EQU    SIZE locs + 1 AND -2    ; even length
  14. loc    EQU    [bp-loc1]        ; negative offset from bp
  15. sub    PROC
  16.     push    bp            ; save old bp
  17.     mov    bp,sp            ; setup new bp
  18.     sub    sp,loc1            ; allocate local storage
  19.     mov    loc[field1],1        ; access local storage
  20.     mov    loc[field2],2
  21.     mov    sp,bp            ; deallocate storage
  22.     pop    bp            ; restore old bp
  23.     ret                ; return to caller
  24. sub    ENDP
  25.     ENDM                ; mproc may be reused
  26.     mproc                ; expand local names
  27.     DB    2000h - ( $ - cseg ) DUP( 0 )
  28.     call    sub            ; forced by DB to 2000h
  29. cseg    ENDS
  30.     END
  31.  
  32.